
<?php
     include_once('Configs/database.php');
     
     class NganhHoc extends database{
         private $manganh;
         private $tennganh;
         private $makhoa;
         public function setManganh($manganh){
            $this->manganh = $manganh;
         }
         public function setTenNganh($tennganh){
            $this->tennganh = $tennganh;
         }
         public function setMaKhoa($makhoa){
            $this->makhoa = $makhoa;
         }
         public function getMaNganh(){
            return $this->manganh;
         }
         public function getMaKhoa(){
            return $this->makhoa;
         }
         public function getTenNganh(){
            
             return $this->tennganh;
         }
         //public function themnganh($manganh,$tennganh,$makhoa){
            
         //}
         public function themNganh(){
                
            
             $this->setQuery("insert into NganhHoc(manganh,tennganh,makhoa) values ('".$this->getMaNganh()."','".$this->getTenNganh()."','".$this->getMaKhoa()."')");
             
             return $this->executeQuery();
         }
         public function suaNganh(){
            $this->setQuery("update NganhHoc set tennganh='".$this->getTenNganh()."',makhoa='".$this->getMaKhoa()."' where manganh='".$this->getMaNganh()."'");
            
            return $this->executeQuery();
         }
         public function xoaNganh(){
            $this->setQuery("delete from NganhHoc where manganh='".$this->getMaNganh()."'");
            return $this->executeQuery();
         }
         /*public function dsNganhTheoKhoa($makhoa){
            $this->setQuery("select * from NganhHoc where makhoa='".$makhoa."'");
            return $this->fetchAll();
         }*/
         public function dsTatCaNganh(){
            $this->setQuery("select * from NganhHoc");
            return $this->fetchAll();
         }
     }
?>
